<?php
/**
* The template for displaying Author Archive pages.
*/

get_header();

	// SIDEBAR
	$content_class = ' class="position_left"';
	$sidebar_class = ' class="position_right"';

	$website_selected_position = get_option('sidebar_position');
	
	if ( $website_selected_position == 'left' )
	{
		$content_class = ' class="position_right"';
		$sidebar_class = ' class="position_left"';
	}

	if ( have_posts() ) the_post();	

?>

	<section id="content_wrapper" class="clearfix">
        <div id="content_with_sidebar" <?php echo $content_class; ?>>
            <h2 class="page_title">
                <?php
				
				printf( __( 'Author Archives: %s', 'reFresh' ), get_the_author() );
				
				?>
            </h2>
            <div class="page_content">
            
				<?php
                if ( get_the_author_meta( 'description' ) ) // If a user has filled out their description, show a bio on their entries 
                {
                    ?>
                    <div id="author_info" class="clearfix author_php">
                        <div id="author_avatar">
                            <?php echo get_avatar( get_the_author_meta( 'user_email' ),  76 ); ?>
                        </div><!-- #author_avatar -->
                        <div id="author_description">
                            <div id="author_name">
                                <?php echo get_the_author(); ?>
                            </div>
                            <div id="the_description">
                                <?php the_author_meta( 'description' ); ?>
                                <a id="author_link" href="<?php echo get_author_posts_url( get_the_author_meta( 'ID' ) ); ?>">
                                    <?php printf( __( 'View all posts by %s', 'reFresh' ), get_the_author() ); ?>
                                </a>
                            </div>
                        </div><!-- #author_description -->
                    </div><!-- #author_info -->
                    <?php
                } // END if ( get_the_author_meta( 'description' ) )
				
				$category_description = category_description();
					if ( ! empty( $category_description ) )
						echo '<div class="archive-meta">' . $category_description . '</div>';
						
				rewind_posts();
				get_template_part( 'loop', 'author' );
				
				?>
            </div><!-- .page_content -->
            
        </div> <!-- #content_with_sidebar -->
        
        <?php
        echo '<div id="sidebar"'.$sidebar_class.'>';
            echo '<div id="sidebar_content">';
                get_sidebar();
            echo '</div>';
        echo '</div>';
        ?>
        
    </section> <!-- #content_wrapper -->

<?php get_footer(); ?>